package com.atao.example.lambda08;

import java.util.function.Function;

/**
 * @author 阿涛
 * @date 2021-03-06
 */
public class Test {

    private static Integer function(String something, Function<String, Integer> function) {
        return function.apply(something);
    }

    private static Integer andFunction(String something, Function<String, Integer> function1, Function<Integer, Integer> function2) {
        return function1.andThen(function2).apply(something);
    }

    public static void main(String[] args) {
        //todo lambda表达式
        int i = function("1000", something -> Integer.parseInt(something));
        System.out.println("lambda表达式function转换：" + i);
        //todo lambda表达式 andThen
        i = andFunction("1000", something -> Integer.parseInt(something), something -> (something % 10));
        System.out.println("lambda表达式function转换：" + i);
    }

}
